#! /usr/bin/env python

index=[(10**i)*(i+1)*9 for i in range(7)]

def desite(n):
    k = 0
    tmp = n
    while(tmp>index[k]):
        tmp = tmp - index[k]
        k += 1

    return int(str(10**(k) + ((tmp-1)/(k+1)))[(tmp-1)%(k+1)])

def main():
    print [desite(10**i) for i in range(7)]
    print reduce(lambda x,y:x*y,[desite(10**i) for i in range(7)],1)

if __name__ == '__main__':
    main()
    
    
    
